//
//  ClownScrollView.m
//  Homework 2016-06-14
//
//  Created by Roach on 16/6/14.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "ClownScrollView.h"

@implementation ClownScrollView

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self setProtertys];
        
    }
    return self;
}

- (void)setProtertys {
    
    self.contentSize = CGSizeMake(1000, 500);
    
    self.pagingEnabled = YES;
    
    
    
}

- (void)addPictures:(NSArray<UIImage *> *)picture {
    
    
    self.contentSize = CGSizeMake(CGRectGetWidth(self.bounds) * picture.count, CGRectGetWidth(self.bounds));
    
    for (int i = 0; i < picture.count; i ++) {
        
        UIImageView *imageView = [[UIImageView alloc]initWithImage:picture[i]];
        imageView.frame = CGRectMake(i * CGRectGetWidth(self.bounds), 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds));
        
        [self addSubview:imageView];
        [imageView release];
    }
    
}

@end
